Skip to content

Fix async test client cleanup#801

Merged
tode-rl merged 1 commit into
mainfrom
fix-ci-async-client-cleanup
May 13, 2026
Merged

Fix async test client cleanup#801
tode-rl merged 1 commit into
mainfrom
fix-ci-async-client-cleanup

Conversation

@tode-rl
Copy link
Copy Markdown
Contributor

@tode-rl tode-rl commented May 13, 2026

Summary

  • keep the shared async test fixture off the SDK global connection pool so parametrized/xdist resource tests do not leak pooled sockets into later tests
  • yield the event loop after closing async test clients so transports can finish cleanup
  • prevents delayed ResourceWarning/PytestUnraisableExceptionWarning failures under warnings-as-errors in CI

Verification

  • env UV_PYTHON='>=3.9.0' ./scripts/test tests/api_resources/test_agents.py tests/sdk/test_async_scenario_builder.py -q
  • env UV_PYTHON='>=3.9.0' ./scripts/test -q
  • uv run ruff check tests/conftest.py
  • uv run ruff format --check tests/conftest.py

Note: ./scripts/lint currently fails before reaching touched code due missing docs Sphinx imports in pyright.

@tode-rl tode-rl force-pushed the fix-ci-async-client-cleanup branch from be76a0e to 0c1b703 Compare May 13, 2026 16:43
@tode-rl tode-rl changed the title Fix aiohttp test client cleanup Fix async test client cleanup May 13, 2026
@tode-rl tode-rl force-pushed the fix-ci-async-client-cleanup branch from 0c1b703 to 03d765f Compare May 13, 2026 16:47
@tode-rl tode-rl enabled auto-merge (squash) May 13, 2026 17:24
@tode-rl tode-rl requested review from jason-rl and jrvb-rl May 13, 2026 18:08
Copy link
Copy Markdown
Contributor

@jason-rl jason-rl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this behavior specific to Python async and the AsyncRunloop object can't do anything about it?

@tode-rl tode-rl merged commit 54a82b3 into main May 13, 2026
9 of 10 checks passed
@tode-rl tode-rl deleted the fix-ci-async-client-cleanup branch May 13, 2026 18:22
@tode-rl
Copy link
Copy Markdown
Contributor Author

tode-rl commented May 13, 2026

I think this is just related to how pytest is using the pool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants